package com.start.workflow.core.api;

import com.start.common.api.Result;
import com.start.common.entity.StartDicData;
import com.start.common.tools.StartEnumTools;
import com.start.workflow.common.enums.StartActHandlerStatus;
import com.start.workflow.core.manage.StartActCandidateManager;
import com.start.workflow.core.manage.StartActCarbonCopyManage;
import com.start.workflow.core.manage.StartActFormManager;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "start流程字典API")
@RestController
@RequestMapping("/startActDicApi")
public class StartActDictApi {
    @Operation(summary = "获取流程表单存储字典")
    @GetMapping("/getActFormStore")
    public Result<?> getActFormStore() {
        List<StartDicData> dicLoad = StartActFormManager.getInstance().getDicLoad();
        return Result.ok(dicLoad);
    }

    @Operation(summary = "获取流程任务候选人字典")
    @GetMapping("/getCandidateType")
    public Result<?> getCandidateType() {
        return Result.ok(StartActCandidateManager.getDicData());
    }

    @Operation(summary = "获取流程抄送字典")
    @GetMapping("/getCarbonCopyType")
    public Result<?> getCarbonCopyType() {
        return Result.ok(StartActCarbonCopyManage.getInstance().getDicData());
    }

    @Operation(summary = "获取流程审批字典")
    @GetMapping("/getActAuthType")
    public Result<?> getActAuthType() {
        List<StartDicData> enumDic = StartEnumTools.getEnumDic(StartActHandlerStatus.class);
        return Result.ok(enumDic);
    }
}
